21 #define MAX_CMD_SIZE 96 22 #define ARRAY_SIZE(_x) (sizeof(_x)/sizeof(_x[0])) 77 void executeCommands(
FSTRINGPARAM(data),
bool waitFinish,
int action);
83 #if BLUETOOTH_SERIAL > 0 128 return ((params & 2)!=0);
132 return ((params & 1)!=0);
136 return ((params & 4)!=0);
140 return ((params & 8)!=0);
147 return ((params & 16)!=0);
154 return ((params & 32)!=0);
161 return ((params & 56)==0);
165 return ((params & 64)!=0);
169 return ((params & 256)!=0);
173 return ((params & 512)!=0);
177 return ((params & 1024)!=0);
181 return ((params & 2048)!=0);
185 return ((params & 4096)!=0);
189 return ((params & 32768)!=0);
193 return ((params2 & 1)!=0);
197 return ((params2 & 2)!=0);
201 return ((params2 & 4)!=0);
205 return ((params2 & 8)!=0);
209 return ((params2 & 16)!=0);
213 return ((params2 & 32)!=0);
217 return ((params2 & 64)!=0);
221 return ((params2 & 128)!=0);
225 return ((params2 & 256)!=0);
229 return ((params2 & 512)!=0);
233 return ((params2 & 1024)!=0);
237 return (hasS() ? S : def);
241 return (hasP() ? P : def);
247 return ((params2 & 32768)!=0);
250 bool parseBinary(uint8_t *buffer,
bool fromSerial);
251 bool parseAscii(
char *line,
bool fromSerial);
252 void popCurrentCommand();
255 static GCode *peekCurrentCommand();
257 static void readFromSerial();
258 static void pushCommand();
260 static uint8_t computeBinarySize(
char *ptr);
262 static void reportFatalError();
263 static void resetFatalError();
265 return fatalErrorMsg != NULL;
274 void debugCommandBuffer();
275 void checkAndPushCommand();
276 static void requestResend();
281 float f = (strtod(s, &endPtr));
282 if(s == endPtr) f=0.0;
289 long l = (strtol(s, &endPtr, 10));
307 #if NEW_COMMUNICATION == 0 322 #define GENBY_SIZE 16 323 class GCodeFileInfo {
325 void init(SdBaseFile &file);
327 unsigned long fileSize;
330 float filamentNeeded;
331 char generatedBy[GENBY_SIZE];
333 bool findGeneratedBy(
char *buf,
char *genBy);
334 bool findLayerHeight(
char *buf,
float &layerHeight);
335 bool findFilamentNeed(
char *buf,
float &filament);
336 bool findTotalHeight(
char *buf,
float &objectHeight);
virtual void writeByte(uint8_t byte)
Definition: gcode.cpp:1447
bool hasO()
Definition: gcode.h:231
bool hasD()
Definition: gcode.h:203
SDCardGCodeSource sdSource
Definition: SDCard.cpp:29
virtual bool supportsWrite()
true if write is a non dummy function
Definition: gcode.cpp:1435
bool hasZ()
Definition: gcode.h:152
uint16_t G
G-code G value if set.
Definition: gcode.h:98
bool hasY()
Definition: gcode.h:145
volatile bool finished
Definition: gcode.h:62
void unsetX()
Definition: gcode.h:142
float L
G-code L value if set.
Definition: gcode.h:115
static uint8_t bufferWriteIndex
Write position in gcode_buffer.
Definition: gcode.h:296
static uint8_t bufferReadIndex
Read position in gcode_buffer.
Definition: gcode.h:295
static uint8_t sendAsBinary
Flags the command as binary input.
Definition: gcode.h:299
bool hasM()
Definition: gcode.h:126
float R
G-code R value if set.
Definition: gcode.h:108
bool hasN()
Definition: gcode.h:130
float H
G-code H value if set.
Definition: gcode.h:111
bool hasNoXYZ()
Definition: gcode.h:159
void unsetY()
Definition: gcode.h:149
SerialGCodeSource(Stream *p)
Definition: gcode.cpp:1429
bool hasL()
Definition: gcode.h:227
bool hasB()
Definition: gcode.h:219
bool hasFormatError()
Definition: gcode.h:246
char * text
Text message of g-code if present.
Definition: gcode.h:118
float Y
G-code Y value if set.
Definition: gcode.h:100
float Z
G-code Z value if set.
Definition: gcode.h:101
bool isV2()
Definition: gcode.h:183
long getP(long def)
Definition: gcode.h:239
#define MAX_CMD_SIZE
Definition: gcode.h:21
bool hasC()
Definition: gcode.h:207
float E
G-code E value if set.
Definition: gcode.h:102
static millis_t timeOfLastDataPacket
Time, when we got the last data packet. Used to detect missing uint8_ts.
Definition: gcode.h:310
FlashGCodeSource flashSource
Definition: gcode.cpp:1320
long parseLongValue(char *s)
Definition: gcode.h:285
Stream * stream
Definition: gcode.h:34
Definition: Communication.h:40
float X
G-code X value if set.
Definition: gcode.h:99
virtual bool isOpen()
Definition: gcode.cpp:1432
bool hasT()
Definition: gcode.h:171
virtual int readByte()
Definition: gcode.cpp:1444
int32_t P
G-code P value if set.
Definition: gcode.h:105
static uint32_t lastLineNumber
Last line number received.
Definition: gcode.h:309
bool internalCommand
Definition: gcode.h:125
virtual bool closeOnError()
Definition: gcode.cpp:1438
static millis_t lastBusySignal
When was the last busy signal.
Definition: gcode.h:306
uint16_t M
G-code M value if set.
Definition: gcode.h:97
FirmwareState
Definition: gcode.h:24
bool hasF()
Definition: gcode.h:167
static bool hasFatalError()
Definition: gcode.h:264
float C
G-code C value if set.
Definition: gcode.h:110
bool hasS()
Definition: gcode.h:175
Definition: Commands.h:27
uint16_t N
Line number reduced to 16 bit.
Definition: gcode.h:96
virtual void close()
Definition: gcode.cpp:1450
void setFormatError()
Definition: gcode.h:243
uint32_t millis_t
Definition: HAL.h:158
bool hasA()
Definition: gcode.h:215
float K
G-code K value if set.
Definition: gcode.h:114
uint8_t T
Definition: gcode.h:122
void unsetZ()
Definition: gcode.h:156
static int8_t waitingForResend
Waiting for line to be resend. -1 = no wait.
Definition: gcode.h:308
static uint8_t commandsReceivingWritePosition
Writing position in gcode_transbuffer.
Definition: gcode.h:298
float F
G-code F value if set.
Definition: gcode.h:103
static uint32_t keepAliveInterval
Definition: gcode.h:268
bool hasH()
Definition: gcode.h:211
float I
G-code I value if set.
Definition: gcode.h:106
int actionOnFinish
Definition: gcode.h:63
static volatile uint8_t bufferLength
Number of commands stored in gcode_buffer.
Definition: gcode.h:304
bool hasP()
Definition: gcode.h:179
int32_t S
G-code S value if set.
Definition: gcode.h:104
bool hasE()
Definition: gcode.h:163
static uint8_t formatErrors
Number of sequential format errors.
Definition: gcode.h:305
static uint32_t actLineNumber
Line number of current command.
Definition: gcode.h:303
bool hasR()
Definition: gcode.h:199
float J
G-code J value if set.
Definition: gcode.h:107
uint16_t params2
Definition: gcode.h:94
static uint8_t binaryCommandSize
Expected size of the incoming binary command.
Definition: gcode.h:301
float B
G-code B value if set.
Definition: gcode.h:113
virtual bool dataAvailable()
Definition: gcode.cpp:1441
#define FSTRINGPARAM(var)
Definition: HAL.h:53
bool hasK()
Definition: gcode.h:223
bool hasString()
Definition: gcode.h:187
float parseFloatValue(char *s)
Definition: gcode.h:277
float D
G-code D value if set.
Definition: gcode.h:109
bool hasJ()
Definition: gcode.h:195
uint16_t params
Definition: gcode.h:93
#define GCODE_BUFFER_SIZE
Definition: Repetier.h:324
float A
G-code A value if set.
Definition: gcode.h:112
bool hasI()
Definition: gcode.h:191
bool hasX()
Definition: gcode.h:138
bool hasG()
Definition: gcode.h:134
static uint8_t wasLastCommandReceivedAsBinary
Was the last successful command in binary mode?
Definition: gcode.h:311
static bool waitUntilAllCommandsAreParsed
Don't read until all commands are parsed. Needed if gcode_buffer is misused as storage for strings...
Definition: gcode.h:302
long getS(long def)
Definition: gcode.h:235
static uint8_t commentDetected
Flags true if we are reading the comment part of a command.
Definition: gcode.h:300
float O
G-code O value if set.
Definition: gcode.h:116